package com.cg.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cg.dao.AppMenuDao;
import com.cg.entity.AppMenuEntity;
import com.cg.service.AppMenuService;

import java.util.*;


@Service("appMenuService")
public class AppMenuServiceImpl implements AppMenuService {
	@Autowired
	private AppMenuDao appMenuDao;
	
	@Override
	public List<AppMenuEntity> queryListParentId(Integer parentId, List<Integer> menuIdList) {
		List<AppMenuEntity> menuList = appMenuDao.queryListParentId(parentId);
		if(menuIdList == null){
			return menuList;
		}
		List<AppMenuEntity> appMenuList = new ArrayList<>();
		for(AppMenuEntity menu : menuList){
			if(menuIdList.contains(menu.getId())){
				appMenuList.add(menu);
			}
		}
		return appMenuList;
	}
	@Override
	public AppMenuEntity queryObject(Integer menuId) {
		return appMenuDao.queryObject(menuId);
	}
	@Override
	public List<AppMenuEntity> queryList(Map<String, Object> map) {
		return appMenuDao.queryList(map);
	}
	@Override
	public int queryTotal(Map<String, Object> map) {
		return appMenuDao.queryTotal(map);
	}
	@Override
	public void save(AppMenuEntity menu) {
		appMenuDao.save(menu);
	}
	@Override
	public void update(AppMenuEntity menu) {
		appMenuDao.update(menu);
	}
	@Override
	public void deleteBatch(Integer[] menuIds) {
		appMenuDao.deleteBatch(menuIds);
	}
	
	
}
